<div id="content">
	<div class="row s_page_title">
		<sa-big-breadcrumbs [items]="['系统基础管理','对公账户管理','账户管理']" icon="fa fa-list" class="col-xs-12 col-sm-7 col-md-7 col-lg-4"></sa-big-breadcrumbs>
	</div>
	<sa-widgets-grid>
		<div class="s_table">
			<div sa-widget [editbutton]="false" color="darken" class="clearfix">
				<header>
					<span class="widget-icon"> <i class="fa fa-table"></i> </span>
					<h2>账户管理</h2>
				</header>
				<div>
					<div class="widget-body no-padding">
						<div class="page-header clearfix s_table_opreation">
							<div class="left page-header-btn">
								<div class="top_module">
									<span class="module_text">项目名称</span>
									<sa-company-tree companyTreeId="companyTree" (companySelected)="companySelected($event)">
									</sa-company-tree>
								</div>
								<div class="top_module top_module_box">
									<span class="top_module_label module_text">账户类型</span>
									<select name="" class="top_module_select" [(ngModel)]="tableSearch.accountType">
										<option value="">全部</option>
										<option value="1">水泥厂</option>
										<option value="2">中间商</option>
									</select>
								</div>
								<div class="top_module top_module_box">
									<span class="module_text">账户名称</span>
									<input type="text" class="module_inp top_module_select" [(ngModel)]="tableSearch.accountName" placeholder="账户名称" />
								</div>
								<button class="btn btn-primary" (click)="table_search()">查询</button>
								<button class="btn btn-primary" (click)="table_add(CorporateAccountModal)">新增</button>
							</div>
						</div>
						<div class="table_scroll">
							<table class="display dataTables responsive table table-striped table-bordered table-hover dataTable s_h5_table">
								<thead>
									<tr>
										<th>项目名称</th>
										<th style="width:35%;">对接厂区</th>
										<th>账户类型</th>
										<th>账户名称</th>
										<th>累计付款</th>
										<th>备注</th>
										<th>创建时间</th>
										<th>创建人</th>
										<th>更新时间</th>
										<th>操作</th>
									</tr>
								</thead>
								<tbody>
									<tr *ngFor="let row of tableData">
										<td>{{row.companyName}}</td>
										<td style="white-space: normal;">{{row.factoryName}}</td>
										<td>
											<span *ngIf="row.accountType == 1">水泥厂</span>
											<span *ngIf="row.accountType == 2">中间商</span>
										</td>
										<td>{{row.accountName}}</td>
										<td>{{row.accountPrice}}</td>
										<td>{{row.remark}}</td>
										<td>{{row.createTime}}</td>
										<td>{{row.createName}}</td>
										<td>{{row.updateTime}}</td>
										<td>
											<button type="button" (click)="financialDetails(row)">资金明细</button>
											<button type="button" (click)="editRow(row,CorporateAccountModal)">编辑</button>
											<button type="button" (click)="delRow(row)">刪除</button>
										</td>
									</tr>
								</tbody>
							</table>
						</div>
						<div class="table-fix clearfix">
							<paginator [totalRecords]="totalCount" [rows]="pageSize" [currentPage]="curPage - 1" (onPageChange)="paginate($event)">
							</paginator>
							<button type="button" class="btn default refresh_btn" (click)="refresh()"><i class="fa fa-refresh"></i></button>
						</div>
					</div>
				</div>
			</div>
		</div>
	</sa-widgets-grid>


	<!--    弹窗-->
	<section bsModal #CorporateAccountModal="bs-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
		<div class="modal-dialog modal-lg">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" (click)="modalClose(CorporateAccountModal)" aria-label="Close"><span aria-hidden="true">&times;</span></button>
					<h4 class="modal-title">账户管理 - <span *ngIf="formType == 'new'">新增</span><span *ngIf="formType == 'updata'">编辑</span></h4>
				</div>
				<form id="CorporateAccountFrom" class="form-horizontal" role="form" novalidate="novalidate" [saBootstrapValidator]="validatorOptions">
					<div class="modal-body">
						<div class="row form-horizontal">
							<div class="form-group col-xs-12 s_fix_select2">
								<label class="control-label col-xs-2" for="newPassword">项目名称<sup>*</sup></label>
								<div class="col-xs-10 s_fix_select2_width s_fix_select2 ">
									<sa-select2 select2ElementID="roleSelect2Form" (optionSelected)="optionSelectedForm($event)" [dataList]="companyList" [paramFormat]="paramFormat" matchSearch="true">
									</sa-select2>
								</div>
							</div>
							<div class="form-group col-xs-12" id="controlTreeCompany">
								<label class="control-label col-xs-2">对接厂区<sup>*</sup></label>
								<div class="col-xs-10">
									<sa-company-tree-checkbox wrap="html" [threeState]="threeStateText" [inputApi]="inputApi" [inputParam]="inputParam" companyTreeId="companyTreeFrom" [Height]="32" [companyValue]="companyArrays" (companySelected)="addCompanySelected($event)" (click)="companySelectedClick()"></sa-company-tree-checkbox>
								</div>
							</div>
							<div class="form-group col-xs-12">
								<label class="control-label col-xs-2 no-padding-right">账户类型<sup>*</sup></label>
								<div class="col-xs-10">
									<select class="form-control" name="accountType" [(ngModel)]='CorporateAccountFrom.accountType' style="width: 100%">
										<option value="">请选择</option>
										<option value="1">水泥厂</option>
										<option value="2">中间商</option>
									</select>
								</div>
							</div>
							<div class="form-group col-xs-12">
								<label class="col-xs-2 control-label">账户名称<sup>*</sup></label>
								<div class="col-xs-10 insert_text">
									<input class="form-control" [(ngModel)]='CorporateAccountFrom.accountName' name='accountName' />
								</div>
							</div>
							<div class="form-group col-xs-12">
								<label class="col-xs-2 control-label">备注</label>
								<div class="col-xs-10 insert_text">
									<input class="form-control" [(ngModel)]='CorporateAccountFrom.remark' name='remark' />
								</div>
							</div>
						</div>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-default" (click)="modalClose(CorporateAccountModal)">取消</button>
						<button type="button" class="btn btn-primary" (click)="apiControlSubmit(CorporateAccountModal)">确认</button>
					</div>
				</form>
			</div>
		</div>
	</section>
	<!--  弹窗end-->
</div>